using System.Windows.Forms;
using System.Drawing;
using System;
using Jonathan.Controls;

namespace Jonathan
{
    public class BookMarkDropDown : ToolStripDropDown
    {
        private CtrlBookMark _BookMark;

        public BookMarkDropDown (FrmMain main)
        {
            this._BookMark = new CtrlBookMark(main, this);
            Items.Add(new ToolStripControlHost(_BookMark));
        }

        /// <summary>
        /// Closes the Drop Down Menu...
        /// </summary>
        public void CloseDropDown ()
        {
            this.Close(ToolStripDropDownCloseReason.CloseCalled);
        }

        protected override void OnOpening (System.ComponentModel.CancelEventArgs e)
        {
            base.OnOpening(e);

            ToolStripProfessionalRenderer renderer = Renderer as ToolStripProfessionalRenderer;

            if (renderer != null)
                _BookMark.BackColor = renderer.ColorTable.ToolStripDropDownBackground;
        }

        protected override void OnOpened (EventArgs e)
        {
            base.OnOpened(e);
            _BookMark.Focus();
        }

        /// <summary>
        /// Gets the Book Mark Control...
        /// </summary>
        public CtrlBookMark BookMarkControl
        {
            get { return this._BookMark; }
        }
    }
}
